home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / PACKER.ZIP / PACKER.DOC < prev    next >
Text File  |  1994-10-08  |  17KB  |  337 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.   ┌─────────────────────────────────────────────────────────────────────────┐
  9.   │  ▀██▀█▄    ██     ▄█▀▀▄ ▀██   ▄▄ ▀██▀▀██ ▀██▀█▄           ▄▄      ▄▄▄   │█
  10.   │   ██▄█▀   ▐██▌   ▐█▌     ██ ▄█▀   ██ ▄ ▀  ██▄█▀         ▄▀██     ██ ██  │█
  11.   │   ██      █▄██   ██      ████▄    ██▀█    ██▀█▄           ██     ██ ██  │█
  12.   │   ██     ▐▌ ▐█▌  ▐█▌     ██▀██▄   ██   ▄  ██ ▐█▌          ██     ██ ██  │█
  13.   │  ▄██    ▄█▄ ▄██▄  ▀█▄▄▀ ▄██  ██▄ ▄██▄▄██ ▄██  ██▄        ▄██▄ ██ ▀█▄█▀  │█
  14.   └─────────────────────────────────────────────────────────────────────────┘█
  15.     ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  16.       Packer (for TP) version 1.0 (c) 1994 IH software engineering, ISRAEL.
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.   ┌──────────────────────────────────────────────────────────────────────────┐
  26.   │░░░▒▒▒▓▓▓                      Introduction                      ▓▓▓▒▒▒░░░│
  27.   └──────────────────────────────────────────────────────────────────────────┘
  28.  
  29.    Packer is a tool for Turbo Pascal programmers, that will make your software
  30.    more PROFESSIONAL than ever!
  31.    Packer will combine all your programs files into 1 large file, and give
  32.    you the appropriate tools to access this package within your programs!
  33.    To DEMONSTRATE the functional usage of Packer, take for instance a simple
  34.    GAME - the game uses pictures, fonts, etc., a total of some 50 files.
  35.    That is not very elegant, is it? That's where packer gets into the picture:
  36.    Packer will take all those files that your program uses, and convert them
  37.    into 1 big file (package), so your program is now made of ONLY 2 FILES:
  38.    EXE and PAK! An extremly powerful option is to convert those 2 files into
  39.    ONLY 1 file by copying the package to the EXE file! Doesn't it look
  40.    PROFESSIONAL ?!?
  41.       You are probably thinking now : "I can make my personal Packer" - Well,
  42.    you can, but it will take you a lot of time, and time is money, so why
  43.    won't you give this great tool a chance?   You can use Packer right now
  44.    for evaluation and testing. If you like it (and you WILL like it!), you
  45.    will probably register it! Packer was built to SAVE YOU TIME in your
  46.    programming work, so don't waste your time for nothing, purcase Packer now!
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.   ┌──────────────────────────────────────────────────────────────────────────┐
  61.   │░░░▒▒▒▓▓▓                      Registration                      ▓▓▓▒▒▒░░░│
  62.   └──────────────────────────────────────────────────────────────────────────┘
  63.  
  64.    Packer IS NOT FREE, it is neither shareware nor public domain. It consists
  65.    of many hours of hard work, and deserves payment. Therefore, only the TPU
  66.    file (Compiled unit) is distributed to you, so you can test this program
  67.    and decide if you want to use it or not. If you want to use Packer, you
  68.    will have to register it by printing the registration form (included in
  69.    this archive) and sending it to me (the author) to the address listed in
  70.    the registration form. To print the registration form, just type at the
  71.    DOS-prompt : COPY WORLD.REG PRN
  72.  
  73.    If you have a Modem connected to your computer, you may choose not to get
  74.    Packer on a disk, but get it with your modem. This will save you the
  75.    Disk & P&P fee. If you choose so, you will have to call Fata-Morgana BBS,
  76.    +972-6-526125 (06-526125 inside Israel) and download the registered version
  77.    of Packer - registered to you. In this case, please call about 1 or 2 weeks
  78.    after you send the registration form by mail. Only a week after you send
  79.    this form you should try to call the BBS. You will have instructions
  80.    on-line how to download your Packer. Please make sure your communication
  81.    program is set to 8,N,1 and ANSI emulation. At logon, enter: Packer User
  82.    The BBS password is: Packer. Then enter your personal password (as you
  83.    choosed in the form) and your phone number. After this validation, the
  84.    registered version of Packer with be sent to you with Z-modem protocol.
  85.    This procedure will take maximum 5 minutes to stay on-line.
  86.  
  87.    After registration you will receive the registered version of Packer,
  88.    registered to you, (or your company), without any annoying "unregistered"
  89.    message and with EXTRA BONUS read / write routines that will make your
  90.    programming much easier, and you will also get 50% discount on future
  91.    releases of Packer (c) from IH software!
  92.  
  93.    BBS OPERATORS (SYSOPS) - Contact us if you want your BBS to support the
  94.    Packer, and you will receive free updates whenever available. Print the
  95.    SYSOP.DOC file for more details.
  96.  
  97.    VENDORS and SOFTWARE PUBLISHERS - You may put this program into your CD-
  98.    collections if you like, but please notify us if you do that. Please
  99.    print the VENDOR.DOC file and send it to us.
  100.  
  101.   ┌──────────────────────────────────────────────────────────────────────────┐
  102.   │░░░▒▒▒▓▓▓                  Lisence and agreement                 ▓▓▓▒▒▒░░░│
  103.   └──────────────────────────────────────────────────────────────────────────┘
  104.  
  105.    There is no warranty with this software. IH software takes no responsibility
  106.    for any damage caused by usage of this software.
  107.    You may upload this archive to any BBS if you like, but with no changes!
  108.    To get the original Packer archive, call Fata-Morgana BBS: telephone #:
  109.    +972-6-526125, 24 hours a day, max speed: 14,400 bps.
  110.    You MAY NOT copy or distribute the registered version of Packer
  111.    (PACKER.TPU), nor charge for unauthorized usage of Packer.
  112.    Every program you create with Packer will have your serial number in it,
  113.    so IH software will be able to locate unlawful users and prosecute them
  114.    acording to international copyright laws.
  115.  
  116.    IH software will be glad to solve your problems / questions ONLY after
  117.    registration and showing your support. Your registration is required in
  118.    order to make this software succeed.
  119.  
  120.   ┌──────────────────────────────────────────────────────────────────────────┐
  121.   │░░░▒▒▒▓▓▓                      Installation                      ▓▓▓▒▒▒░░░│
  122.   └──────────────────────────────────────────────────────────────────────────┘
  123.  
  124.    Copy the appropriate version of PACKER.TPU into your units-directory:
  125.  
  126.    PACKER60.TPU - Packer for Turbo Pascal 6
  127.    PACKER70.TPU - Packer for Turbo Pascal 7
  128.    PACKER70.TPP - Packer for Borland Pascal 7 (Protected mode)
  129.    PACKER70.TPW - Packer for Borland Pascal 7 (Windows version)
  130.  
  131.    Very important! You MUST rename the file to PACKER.TPU/TPP/TPW !
  132.    ═══════════════
  133.  
  134.    Rename it to PACKER.TPU if you use Turbo Pascal, or to PACKER.BPU if you
  135.    use Borland Pascal.
  136.  
  137.    To use Packer in one of your programs, implement Packer at the beginning
  138.    of the program (in the USES part). Examples: Uses Packer; 
  139.  
  140.   
  141.   ┌──────────────────────────────────────────────────────────────────────────┐
  142.   │░░░▒▒▒▓▓▓             Creating Packs with PACKER.EXE             ▓▓▓▒▒▒░░░│
  143.   └──────────────────────────────────────────────────────────────────────────┘
  144.  
  145.    With the file PACKER.EXE (included in this package) you will build your
  146.    packs for your programs. This is an external program that will combine
  147.    all the files that your program needs into 1 large Pack file.
  148.    Enter at the DOS-prompt: PACKER and you will be asked for a name for your
  149.    pack. You can supply this name in the command line parameter, by typing
  150.    PACKER <packname>. Then press "Y" to create a new packet.
  151.  
  152.    You will now have to set the maximum number of files in your pack file.
  153.    The range must be from 1 to 3120. The less this number, the less disk
  154.    space your pack will take.
  155.    Note that you will not be able to pack MORE files than this maximum number,
  156.    but you can easily pack LESS files, leaving you extra space for more files.
  157.  
  158.    After you size your pack, you will reach the main menu of PACKER.EXE.
  159.    You have the option to Add files to the Pack, List files in the pack,
  160.    or Delete the entire Pack. Deleting a specific file from the Pack is
  161.    available only in the REGISTERED version of Packer.
  162.  
  163.    After you finish adding files into your pack, press Q to quit from
  164.    PACKER.EXE. Your Pack is now ready!
  165.  
  166.    Note that you can run PACKER.EXE on your pack to edit / view / add more
  167.    files to your pack at any time you want.
  168.  
  169.  
  170.   ┌──────────────────────────────────────────────────────────────────────────┐
  171.   │░░░▒▒▒▓▓▓                Functions and Procedures                ▓▓▓▒▒▒░░░│
  172.   └──────────────────────────────────────────────────────────────────────────┘
  173.  
  174.    PROCEDURE InitPack       (FileName:String);
  175.    PROCEDURE InitFileInPack (FileNumber:Word);
  176.    PROCEDURE SeekFileInPack (SeekPos:LongInt);
  177.    PROCEDURE PackReadBlock  (var buf; count:Word; var result:word);
  178.    PROCEDURE PackReadByte   (var B:Byte);
  179.    PROCEDURE ClosePack;
  180.  
  181.    FUNCTION  GetFileNumber (FileName   : String) : Word;
  182.    FUNCTION  GetFileName   (FileNumber : Word)   : String;
  183.    FUNCTION  GetFileSize   (FileNumber : Word)   : LongInt;
  184.    FUNCTION  GetFilePosition                     : LongInt;
  185.    FUNCTION  GetNumberOfFiles                    : Word;
  186.  
  187.  
  188.    PROCEDURE InitPack       (FileName:String);
  189.  
  190.    This procedure should be called before the other functions & procedures.
  191.    It will init the Pack for reading, and take care of some other things
  192.    as well... FileName is a full path name of a Pack file, or EXE file which
  193.    stores the Pack as an overlay. In both ways, the procedure will take care
  194.    of identifing the pack, and you don't have to worry about it!
  195.    The procedure will allocate some memory for the files-list inside your
  196.    Pack, and will need 21 bytes for each file in your Pack. Don't forget to
  197.    deallocate that memory after you finish using the Pack (look: ClosePack).
  198.    Example: InitPack ('TEST.PAK');
  199.  
  200.  
  201.    PRROCEDURE InitFileInPack (FileNumber:Word);
  202.  
  203.    This procedure will initialize Packer for reading a specific file from
  204.    the Pack. You must call the InitPack procedure before you can use this
  205.    procedure. FileNumber should be the number of the file you want to init.
  206.    Example: InitFileInPack (1);
  207.  
  208.    PROCEDURE SeekFileInPack (SeekPos:LongInt);
  209.  
  210.    Like the regular SEEK procedure, this one will move the file pointer to
  211.    a specific location in the file. SeekPos is the location you want to seek
  212.    into. 0 is the first byte of the file, and the last byte of the file is
  213.    located in FileSize-1. Use InitFileInPack before calling this procedure.
  214.    Example: SeekFileInPack(99);
  215.  
  216.  
  217.  
  218.    PROCEDURE PackReadBlock (var buf; count:word; var result:word);
  219.  
  220.    This is a powerful and fast reading procedure!
  221.    You can read from the Pack (after you call InitFileInPack) to any variable
  222.    you want! This can be an array, pointer, word, longint, string, etc...
  223.    buf is an untyped variable, and will contain the data that will be read
  224.    from the file. Count is the number of bytes to read from the file into
  225.    the memory. You can read up to 64KB at the same time because of the 64K
  226.    limitation. result will contain the number of bytes that were read from
  227.    the file. If result < count, then you tried to read past the end of the
  228.    file. In result = count, everything was fine. Note that you must use the
  229.    result variable, and it is not optional.
  230.    Example: PackReadBlock (P^,65535,result); { var P:Pointer }
  231.    Note that when using pointers, you must take care of the GetMem and
  232.    FreeMem procedures. Don't forget the to add the "^" after the name of the
  233.    pointer. This is VERY important!
  234.    Another example: PackReadBlock (S40,41,result); { var S40:String[40] }
  235.    In this example, Packer will read 41 bytes into the String variable.
  236.    Note that you should read 1 extra byte, which contains the actual length
  237.    of the string. To read a word variable, you need to read 2 bytes, so you
  238.    write: PackReadBlock (W,2,result); { var W:Word }
  239.    After you use this procedure, the seek-pointer will point to the next
  240.    byte in the file that wasn't read yet.
  241.  
  242.    PROCEDURE PackReadByte (var B:Byte);
  243.  
  244.    This is a very easy procedure that will read 1 byte from the current
  245.    position of the file into a Byte variable.
  246.    Example: PackReadByte (B);
  247.    This procedure is similar to PackReadBlock (B,1,result);
  248.  
  249.    PROCEDURE ClosePack;
  250.  
  251.    After you finish using your Pack, or before you want to Init a different
  252.    Pack, you should call this procedure to deallocate the memory that was
  253.    used to store the files names. Use this procedure before you exit your
  254.    program! Example: ClosePack;
  255.  
  256.    FUNCTION GetFileNumber (FileName : String) : Word;
  257.  
  258.    This function will get the string variable "FileName", look if it exists
  259.    in your Pack file, and if so - it will return the FileNumber.
  260.    Example: InitFileInPack( GetFileNumber('TEST.DAT') );
  261.    The InitPack procedure gets a word-type parameter, but you can use the
  262.    GetFileNumber function to use file names instead of file numbers.
  263.    The first file in the Pack is number 1, and so on.
  264.    If you want to init a file, and you don't know it's number, you can use
  265.    the GetFileNumber function. But if you know the number of the file, it is
  266.    better to use the number instead of the filename, since it takes less
  267.    space, less memory and that means - better performances!
  268.    Note that you must call InitPack before using this function!
  269.  
  270.    FUNCTION GetFileName (FileNumber : Word) : String;
  271.  
  272.    This is the oposite of GetFileNumber. This function will take a word-type
  273.    parameter, and return the file name as a string-type.
  274.    Example: WriteLn ( GetFileName(1) );
  275.  
  276.  
  277.  
  278.    FUNCTION GetFileSize (FileNumber : Word) : LongInt;
  279.  
  280.    This function will return the size of file inside the Pack. FileNumber is
  281.    the number of the file in the Pack. The function will return a LongInt-
  282.    type variable, with the size of the file in bytes.
  283.  
  284.    FUNCTION  GetFilePosition : LongInt;
  285.  
  286.    The function will return the current seek position in the current file.
  287.    After you call InitFileInPack, the seek position is reset to 0.
  288.    Every time you read from the file with PackReadBlock / PackReadByte,
  289.    the seek pointer is increased to the next location in the file.
  290.  
  291.    FUNCTION  GetNumberOfFiles : Word;
  292.  
  293.    This function will return the number of files in the Pack. It should be
  294.    called after InitPack.
  295.    Example: WriteLn('Number of files in your Pack: ',GetNumberOfFiles);
  296.  
  297.    PACKER ERRORS:
  298.    1.  Overlay not found in EXE file
  299.    2.  Error in Pack file
  300.    3.  Pack file not found
  301.  
  302.   ┌──────────────────────────────────────────────────────────────────────────┐
  303.   │░░░▒▒▒▓▓▓           Linking the Pack with the EXE file           ▓▓▓▒▒▒░░░│
  304.   └──────────────────────────────────────────────────────────────────────────┘
  305.  
  306.    You have probably wondered how it can be done, right?
  307.    First, you have to create your Pack with PACKER.EXE, and save it by the
  308.    name MYPACK.PAK (or any other name). Then, in your program source code,
  309.    use the TEMPORARY command InitPack('C:\PATH\MYPACK.PAK');
  310.    This will allow you to debug your program, test it, etc.
  311.    ONLY after your program is 100% ready, and you have tested it few times,
  312.    you should follow these instructions:
  313.      1. Change the temporary command to InitPack(ParamStr(0));
  314.      2. Compile your program (do not run it yet!) and create the EXE file.
  315.      3. In the DOS-prompt type: COPY /B PROGRAM.EXE + MYPACK.PAK PROGRAM.EXE.
  316.    Now your program is made from only 1 file! Remember that you can not run
  317.    the program from Turbo Pascal itself. You must compile the program first!
  318.    About EXE files compressors (like PKLITE and LZEXE):
  319.    Packer will still work, but remember to compress the EXE file BEFORE you
  320.    link the Pack to the EXE file.
  321.    ParamStr(0) is the full path & name of the program that is being loaded,
  322.    for instance: 'C:\PATH\PROGRAM.EXE';
  323.    Packer will automatically determine if the EXE file contains the PAK
  324.    as an overlay or not.
  325.  
  326.   ┌──────────────────────────────────────────────────────────────────────────┐
  327.   │░░░▒▒▒▓▓▓                       Thanks to:                       ▓▓▓▒▒▒░░░│
  328.   └──────────────────────────────────────────────────────────────────────────┘
  329.                                                            
  330.    Thanks go to all the following people and all the other guys I forgot
  331.    to mention their names!
  332.  
  333.    Aric Fedida - Who tought me Turbo Pascal - Thanks man!
  334.    Tzvika Gelber - Who gave me the inspiration for writing this software!
  335.    Goor Sasson - Thanks for helping me solve the pointer bug!
  336.    Ohad Shalom - Hi dude... Thanks for helping me every time you call :)
  337.